package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 插入套餐关联的菜品
     * @param dishes
     */
    void insertBatch(List<SetmealDish> dishes);

    /**
     * 清空套餐中的菜品信息
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteById(Long id);

    /**
     * 根据id查询套餐关联的菜品
     * @return
     */
    @Select("SELECT * FROM setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getBySetmealId(Long id);

    /**
     * 根据id查询菜品列表
     * @param ids
     * @return
     */
    Integer countByDishId(List<Long> ids);

    /**
     * 批量删除套餐中的菜品
     * @param ids
     */
    void deleteBatch(List<Long> ids);
}
